package day4.game;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * ClassName：Test
 *
 * @Author：小鱼
 * @Create：2025-08-14 14:51
 */
public class Test {
    public static void main(String[] args) {
        //生成54张扑克牌（一个集合）
           //花色信息
           String[] suit = {"♠","♥","♦","♣"};
           //点数信息
           String[] rank = { "3", "4", "5", "6", "7", "8", "9", "10",
                "J", "Q", "K", "A","2"};
           //生成扑克牌
           List<Card> list = new ArrayList<>();
           int weight = 3;
           for (int i = 0; i < 13; i++) {
               for (int j = 0; j < 4; j++) {
                   list.add(new Card(suit[j],rank[i],weight));
              }
                weight++;
           }
           //增加大小王
           list.add(new Card("","小王",16));
           list.add(new Card("","大王",17));

        //洗牌
        Collections.shuffle(list);

        //三个人交替摸牌（三个集合）
        // 最后三张底牌不能摸（一个集合）
        List<Card> play1 = new ArrayList<>();
        List<Card> play2 = new ArrayList<>();
        List<Card> play3 = new ArrayList<>();
        List<Card> bottom = new ArrayList<>();
        for (int i = 0; i < 51; i++) {
            if (i % 3 == 0) {
                play1.add(list.get(i));
            } else if (i % 3 == 1) {
                play2.add(list.get(i));
            } else {

                play3.add(list.get(i));
            }
        }
        bottom.add(list.get(51));
        bottom.add(list.get(52));
        bottom.add(list.get(53));

        //展示底牌
        Collections.sort(bottom);
        System.out.println("底牌为："+bottom);
        //展示三个人的牌
        Collections.sort(play1);
        Collections.sort(play2);
        Collections.sort(play3);
        System.out.println("玩家一："+play1);
        System.out.println("玩家二："+play2);
        System.out.println("玩家三："+play3);
    }
}
